﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace PiscoSourDominio
{
    public class DateValAttribute: ValidationAttribute
    {

        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            DateTime dt;
            bool parsed = DateTime.TryParse(value.ToString(), out dt);

            if (!parsed)
                return new ValidationResult("Fecha Incorrecta");

            return ValidationResult.Success;
        }
    }
}
